<?php
	
	require 'viewer.php';
	
	$stitchid = $_GET{'stitchid'};
	$greater = $_GET{'greater'};
	$terms = $_GET{'terms'};

	$img = getNextImage($stitchid, $greater, $terms);
	
	if(is_null($img)) {
		echo "new_thumb = null;";
		return;  
	}
	
	$id = $img->stitchid;
	$title = $img->title;
	$author = $img->author;

	echo "new_thumb = new Object();\n";
	echo "new_thumb.id = $id;\n";
	echo "new_thumb.title = \"$title\";\n";
	echo "new_thumb.author = \"$author\";\n";
	echo "new_thumb.img = \"http://www.srcf.ucam.org/cshotel/stitched/" . $id . "_thumb.jpg\";\n";
	echo "new_thumb.src = \"http://www.srcf.ucam.org/cshotel/stitched/" . $id . ".xml\";\n";
	
?>